<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-7-18
 * Time: 下午3:04
 */

namespace ActionsHttp;

use Data\Order_form_DAO;
use Data\Order_for_foods_DAO;
use Data\Food_DAO;

class RestaurantOrderFormListReminder extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        // 每页显示条数
        $every_page_counts = (int)$this->data[EVERY_PAGE_COUNTS];
        // 上一页最后一条催单id
        $last_id = (int)$this->data[LAST_ID];

        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;
        $date = $this->data[DATE];
        $reminder_status = REMINDER_STATUS_START;
        $table_number = $this->data[TABLE_NUM];
        // 订单号
        $order_num = $this->data[ORDER_NUM];
        // 催单记录
        $reminder_order_form_list = Order_form_DAO::getListReminder($restaurant_id,$date,$reminder_status,$last_id,$every_page_counts,$table_number,$order_num);
        $order_info = array();
        foreach ($reminder_order_form_list as $reminder_order_form_record) {
            $order_form_id = $reminder_order_form_record->getORDER_FORM_ID();
            // 订单中商品信息
            $order_for_food_list = Order_for_foods_DAO::getListByOrderFormId($order_form_id);
            // 订单全部信息
            $order_info[] = array(ORDER_FORM_INFO=>$reminder_order_form_record->getArray(),ORDER_FOR_FOOD_INFO=>$order_for_food_list);
        }

        $this->setValue(ORDER_FORM_REMINDER_LIST,$order_info);
        $this->ResponseDataToCurrentClient();
    }
}